<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title><?php echo $this->pageTitle ?></title>
        <link href="<?php echo WWW_URL ?>css/bootstrap.css" rel="stylesheet" />
        <link href="<?php echo WWW_URL ?>css/style.css" rel="stylesheet" />
	<link href="<?php echo WWW_URL ?>css/style6.css" rel="stylesheet" />

    </head>

    <body>	
	<input type="hidden" id="urlSite" value="<?php echo SITE_NAME_URL; ?>"/>
	<?php $this->widget('application.widgets.FormPostEvent'); ?>
        <div class="navbar nav-top">

            <div class="container">
                <div class="slo pull-left">Postmyequipment.com: Classified  </div>
                <ul class="menu nav pull-right">
		    <?php if (user()->isGuest) : ?>
    		    <li><a href="<?php echo url('/user/register') ?>">Sign Up</a></li>
    		    <li><a href="<?php echo url('/user/login') ?>">Login</a></li>
		    <?php else : ?>
    		    <li><a href="<?php echo url('user/profile') ?>"><?php echo user()->name ?></a></li>
    		    <li><a href="<?php echo url('user/my_post') ?>">My Posts</a></li>
    		    <li><a href="<?php echo url('user/my_event') ?>">My Events</a></li>
    		    <li><a href="#">Active Members: <?php echo str_pad(user()->id, 9, '0', STR_PAD_LEFT) ?></a></li>
    		    <li><a href="<?php echo url('site/logout') ?>">Logout</a></li>
		    <?php endif; ?>
                </ul><!--nav-->

            </div><!--container-->
        </div><!---navbar-->


        <header>

            <div class="container">
                <div class="pull-left">
                    <div class="logo"><a href="<?php echo bu() ?>"><img src="<?php echo WWW_URL ?>images/logo.png"></a></div>

                </div>
                <nav class="pull-right">
		    <?php
		    $this->widget('bootstrap.widgets.TbMenu', array(
			'items' => array(
			    array('label' => 'HELP', 'url' => array('/site/page', 'alias' => 'help')),
			    array('label' => 'ABOUT US', 'url' => array('/site/page', 'alias' => 'about')),
			    array('label' => 'CONTACT US', 'url' => array('/site/page', 'alias' => 'contact')),
			    array('label' => 'BLOG', 'url' => array('/blog/post'), 'active' => $this->id == 'post' ? true : false),
			    array('label' => 'VENDOR & TECHNICAL SOURCE PAGE', 'url' => array('/ad/vendor')),
			    array('label' => 'HOME', 'url' => array('/')),
			    array('label' => 'Archived Advertisers', 'url' => array('/ad')),
			),
			'htmlOptions' => array(
			    'class' => 'pd-nav'
			)
		    ))
		    ?>
                </nav>

            </div><!--container-->

        </header>


        <div class="container content">
	    <?php echo $content ?>
            <div class="clear"></div>
            <div class="footer">

                <div class="foo-1">
                    <h3>Quick Link</h3>
                    <a href="<?php echo url('/site/page', array('alias' => 'about')) ?>">About Us</a>
                    <a href="<?php echo url('/site/page', array('alias' => 'contact')) ?>">Contact Us</a>
		    <?php if (user()->isGuest) : ?>
    		    <a href="<?php echo url('/site/login') ?>">Sign In</a>
    		    <a href="<?php echo url('/user/register') ?>">Sign Up</a>
		    <?php endif; ?>
                    <a href="<?php echo url('/site/page', array('alias' => 'support')) ?>">Support</a>
                </div>

                <div class="foo-2">
                    <h3>Why use us</h3>
                    <p>
			<?php echo Yii::app()->settings->get('site', 'description'); ?>
                    </p>
                </div>

                <div class="foo-1">
                    <h3>Connect with Us</h3>
                    <a href="<?php echo settings()->get('sem', 'facebook') ?>"><img src="<?php echo WWW_URL ?>images/face.png" width="20px"/> Facebook</a>
                    <a href="<?php echo settings()->get('sem', 'twitter') ?>"><img src="<?php echo WWW_URL ?>images/twe.png" width="20px"/> Twitter</a>
                    <a href="<?php echo SITE_NAME_URL//settings()->get('sem', 'rss')  ?>rss"><img src="<?php echo WWW_URL ?>images/css.png" width="20px"/> RSS</a>
                    <a href="<?php echo settings()->get('sem', 'linkedid') ?>"><img src="<?php echo WWW_URL ?>images/in.png" width="20px"/> Likedin</a>

                </div>
                <div class="foo-3">
                    <h3>Subscribe To RSS</h3>
		    <?php /*
		      <input type="text" class="input-rss" value="Your Name" />
		      <input type="text" class="input-rss" value="Your Email" />
		      <input type="submit" class="btn btn-primary" value="Submit" />
		     * 
		     */ ?>
		    <?php $this->widget('application.widgets.newsletter.WNewsletterForm'); ?>
                </div>

                <div class="left-footer"></div>
                <div class="right-footer"></div>

            </div>
        </div><!--content-->

	<?php
	/**
	 * COMMON DECLARATION FOR JAVASCRIPT
	 */
	?>
	<input type="hidden" value="" id="day-picked-event"/>
	<input type="hidden" value="" id="month-picked-event"/>
	<input type="hidden" value="" id="year-picked-event"/>
	<input type="hidden" value="" id="status-full-event"/>
	<input type="hidden" value="1" id="curr-page-event"/>

        <script language="javascript" type="text/javascript" src="<?php echo WWW_URL ?>js/jquery.easing.js"></script>
        <script language="javascript" type="text/javascript" src="<?php echo WWW_URL ?>js/script.js"></script>
	<script type="text/javascript">
	    $(document).ready(function() {
		var buttons = {previous: $('#jslidernews3 .button-previous'),
		    next: $('#jslidernews3 .button-next')};
		var _complete = function(slider, index) {
		    $('#jslidernews3 .slider-description').animate({height: 0});
		    slider.find(".slider-description").animate({height: 100})
		};
		;
		$('#jslidernews3').lofJSidernews({interval: 4000,
		    direction: 'opacity',
		    duration: 1200,
		    auto: true,
		    mainWidth: 220,
		    buttons: buttons,
		    onComplete: _complete});
	    });</script>

	<script type="text/javascript">
	    $(document).ready(function() {
		var buttons = {previous: $('#jslidernews2 .button-previous'),
		    next: $('#jslidernews2 .button-next')};
		var _complete = function(slider, index) {
		    $('#jslidernews2 .slider-description').animate({height: 0});
		    slider.find(".slider-description").animate({height: 60})
		};
		;
		$('#jslidernews2').lofJSidernews({interval: 4000,
		    direction: 'opacity',
		    duration: 1200,
		    auto: true,
		    mainWidth: 700,
		    buttons: buttons,
		    onComplete: _complete});
	    });</script>

        <script language="javascript" type="text/javascript" src="<?php echo WWW_URL ?>js/custom.js"></script>
        <script type="text/javascript" src="<?php echo WWW_URL ?>js/bootstrap.calendar.js" ></script>
        <link rel="stylesheet" type="text/css" href="<?php echo WWW_URL ?>css/bootstrap.calendar.css" />

	<script type="text/javascript" src=" http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.js"></script>
	<script type="text/javascript" src="<?php echo WWW_URL ?>js/slimScroll.min.js"></script>
        <script type="text/javascript">
	    $(document).ready(function() {

		var evnts = function() {
		    return {
			"event":
				[
				    {"date": "2012-01-25", "title": "1"}
				    , {"date": "2012-02-01", "title": "2"}
				    , {"date": "2012-03-22", "title": "34"}
				    , {"date": "2012-04-03", "title": "123"}
				    , {"date": "2012-05-04", "title": "223"}
				    , {"date": "2012-06-28", "title": "4"}
				    , {"date": "2012-07-28", "title": "5"}
				    , {"date": "2012-08-16", "title": "14"}
				    , {"date": "2012-09-21", "title": "10"}
				    , {"date": "2012-10-21", "title": "10"}
				    , {"date": "2012-11-21", "title": "10"}
				    , {"date": "2012-12-21", "title": "10"}
				    , {"date": "2012-05-03", "title": "1500"}
				    , {"date": "2012-05-04", "title": "1501"}
				]
		    }
		};
		$('#calendar').Calendar({'events': evnts, 'weekStart': 1})
			.on('changeDay', function(event) {
<?php
/*
 * when click on some day		    
 */
//
?>
<?php //assign to hidden input to transfer value into searching date ajax                                                  ?>
		    $('#day-picked-event').val(event.day);
		    $('#month-picked-event').val(event.month);
		    $('#year-picked-event').val(event.year);
		    $('#status-full-event').val(''); //set status for pagination is not full
		    $('#curr-page-event').val(1); //set current page is 1		    
		    jQuery('.event').scrollTop(0);//scroll to top
<?php
//get event by date clicking
?>
		    $.post('<?php echo SITE_NAME_URL ?>event/get_event_by_click', {day: event.day, month: event.month, year: event.year}, function(response) {
			$('.event').html(response);
		    });
		})
			.on('onEvent', function(event) {
		    //alert(event.day.valueOf() + 'day');
		})
			.on('onNext', function(event) {
		    //alert("Next");
		})
			.on('onPrev', function(event) {
		    //alert("Prev");
		})
			.on('onCurrent', function(event) {
		    //alert("Current");
		});
<?php
/*
 * when user click to add new event
 */
?>
		$('#add-event').click(function() {
		    $('#myModal').modal();
		});
	    });</script>
        <script type="text/javascript" src="<?php echo WWW_URL ?>js/jquery.jcarousel.min.js"></script>
        <script type="text/javascript">

	    function mycarousel_initCallback(carousel)
	    {
		// Disable autoscrolling if the user clicks the prev or next button.
		carousel.buttonNext.bind('click', function() {
		    carousel.startAuto(0);
		});
		carousel.buttonPrev.bind('click', function() {
		    carousel.startAuto(0);
		});
		// Pause autoscrolling if the user moves with the cursor over the clip.
		carousel.clip.hover(function() {
		    carousel.stopAuto();
		}, function() {
		    carousel.startAuto();
		});
	    }
	    ;
	    jQuery(document).ready(function() {
		jQuery('#mycarousel').jcarousel({
		    auto: 2,
		    wrap: 'last',
		    initCallback: mycarousel_initCallback
		});
	    });</script>

	<?php
	/**
	 * Scroll view
	 */
	?>	

	<script>
	    jQuery(document).ready(function() {
		jQuery('.event').slimScroll({
		    height: '237px',
		    //start: $(this).find('li').eq(0), //thanh scroll bat dau o tren (top or bottom)
		    position: 'right', //vi tri thanh scroll(left or right)
		    wheelStep: 10,
		    disableFadeOut: true
		});
	    });
<?php
/**
 * Add more event when user scroll to end
 */
?>
	    $(document).ready(function() {
		$('.event').on('scroll', function() {
		    if ($(this).scrollTop() + $(this).height() == $(this)[0].scrollHeight) {
			var checkLoadData = $(this).find('.contain-progress').prop('tagName');
			if (!checkLoadData) {
			    var oSelf = $(this);
			    var statusFull = $('#status-full-event').val();
			    var currPage = $('#curr-page-event').val();
			    var day = $('#day-picked-event').val();
			    var month = $('#month-picked-event').val();
			    var year = $('#year-picked-event').val();
			    if (!statusFull) {
				oSelf.append('<li class="contain-progress"><img src="<?php echo WWW_URL ?>images/progress_bar.gif" /></li>');
				jQuery.post('<?php echo SITE_NAME_URL ?>event/more_event', {day: day, month: month, year: year, currPage: currPage}, function(response) {
				    $(oSelf).find('.contain-progress').remove();
				    if (response) {
					$(oSelf).append(response);
					var nextPage = parseInt(currPage) + 1;
					$('#curr-page-event').val(nextPage);
				    } else {
					$('#status-full-event').val(1);
				    }
				});
			    }
			}
		    }
		});

	    });

	</script>


    </body>
</html>